.class public Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;
.super Landroid/widget/FrameLayout;
.source "CloseableContainer.java"

# interfaces
.implements Landroid/view/View$OnClickListener;
.implements Ljava/lang/Runnable;
.implements Lcom/burstly/lib/component/networkcomponent/burstly/html/ICloseControl;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T:",
        "Landroid/view/View;",
        ">",
        "Landroid/widget/FrameLayout;",
        "Landroid/view/View$OnClickListener;",
        "Ljava/lang/Runnable;",
        "Lcom/burstly/lib/component/networkcomponent/burstly/html/ICloseControl;"
    }
.end annotation


# static fields
.field public static final BOTTOM_CENTER:Ljava/lang/String; = "bottom-center"

.field public static final BOTTOM_LEFT:Ljava/lang/String; = "bottom-left"

.field public static final BOTTOM_RIGHT:Ljava/lang/String; = "bottom-right"

.field public static final CENTER:Ljava/lang/String; = "center"

.field private static final CLOSE_AREA_SIZE:I = 0x32

.field private static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final TAG:Ljava/lang/String; = null

.field public static final TOP_CENTER:Ljava/lang/String; = "top-center"

.field public static final TOP_LEFT:Ljava/lang/String; = "top-left"

.field public static final TOP_RIGHT:Ljava/lang/String; = "top-right"


# instance fields
.field private mCloseAllowedAfter:J

.field private final mCloseArea:Landroid/widget/ImageView;

.field private mCloseClickListener:Landroid/view/View$OnClickListener;

.field private mContainedView:Landroid/view/View;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "TT;"
        }
    .end annotation
.end field

.field private mShowCloseButtonDelay:J

.field private mUiHandler:Landroid/os/Handler;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 43
    const-class v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->TAG:Ljava/lang/String;

    .line 48
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 2
    .parameter "context"

    .prologue
    .line 127
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

    .line 128
    new-instance v0, Landroid/widget/ImageView;

    invoke-direct {v0, p1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    .line 129
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    invoke-virtual {v0, p0}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 130
    const/4 v0, 0x1

    const-string v1, "top-right"

    invoke-virtual {p0, v0, v1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->setShowCloseIndicator(ZLjava/lang/String;)V

    .line 131
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    invoke-virtual {p0, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->addView(Landroid/view/View;)V

    .line 132
    return-void
.end method

.method private isBackKeyAllowed()Z
    .locals 4

    .prologue
    .line 231
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iget-wide v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseAllowedAfter:J

    cmp-long v0, v0, v2

    if-lez v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method private setCloseAreaBackground(Landroid/graphics/drawable/Drawable;)V
    .locals 2
    .parameter "drawable"
    .annotation build Landroid/annotation/TargetApi;
        value = 0x10
    .end annotation

    .prologue
    .line 222
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0x10

    if-ge v0, v1, :cond_0

    .line 223
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    invoke-virtual {v0, p1}, Landroid/widget/ImageView;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 227
    :goto_0
    return-void

    .line 225
    :cond_0
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    invoke-virtual {v0, p1}, Landroid/widget/ImageView;->setBackground(Landroid/graphics/drawable/Drawable;)V

    goto :goto_0
.end method


# virtual methods
.method public dispatchKeyEvent(Landroid/view/KeyEvent;)Z
    .locals 2
    .parameter "event"

    .prologue
    .line 236
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    invoke-virtual {p1}, Landroid/view/KeyEvent;->getKeyCode()I

    move-result v0

    const/4 v1, 0x4

    if-ne v0, v1, :cond_0

    invoke-direct {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->isBackKeyAllowed()Z

    move-result v0

    if-nez v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    invoke-super {p0, p1}, Landroid/widget/FrameLayout;->dispatchKeyEvent(Landroid/view/KeyEvent;)Z

    move-result v0

    goto :goto_0
.end method

.method protected getCloseArea()Landroid/widget/ImageView;
    .locals 1

    .prologue
    .line 304
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    return-object v0
.end method

.method public getCloseClickListener()Landroid/view/View$OnClickListener;
    .locals 1

    .prologue
    .line 255
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseClickListener:Landroid/view/View$OnClickListener;

    return-object v0
.end method

.method public getContainedView()Landroid/view/View;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()TT;"
        }
    .end annotation

    .prologue
    .line 313
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mContainedView:Landroid/view/View;

    return-object v0
.end method

.method public getShowCloseButtonDelay()J
    .locals 2

    .prologue
    .line 273
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    iget-wide v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mShowCloseButtonDelay:J

    return-wide v0
.end method

.method protected onAttachedToWindow()V
    .locals 4

    .prologue
    .line 175
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    invoke-super {p0}, Landroid/widget/FrameLayout;->onAttachedToWindow()V

    .line 176
    iget-wide v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mShowCloseButtonDelay:J

    const-wide/16 v2, 0x0

    cmp-long v0, v0, v2

    if-lez v0, :cond_1

    .line 177
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mUiHandler:Landroid/os/Handler;

    if-nez v0, :cond_0

    .line 178
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mUiHandler:Landroid/os/Handler;

    .line 180
    :cond_0
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iget-wide v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mShowCloseButtonDelay:J

    add-long/2addr v0, v2

    iput-wide v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseAllowedAfter:J

    .line 181
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mUiHandler:Landroid/os/Handler;

    iget-wide v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mShowCloseButtonDelay:J

    invoke-virtual {v0, p0, v1, v2}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 183
    :cond_1
    return-void
.end method

.method public onClick(Landroid/view/View;)V
    .locals 4
    .parameter "v"

    .prologue
    .line 242
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseClickListener:Landroid/view/View$OnClickListener;

    if-nez v0, :cond_0

    .line 243
    sget-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v1, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->TAG:Ljava/lang/String;

    const-string v2, "Close action is not defined"

    const/4 v3, 0x0

    new-array v3, v3, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 247
    :goto_0
    return-void

    .line 245
    :cond_0
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseClickListener:Landroid/view/View$OnClickListener;

    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mContainedView:Landroid/view/View;

    invoke-interface {v0, v1}, Landroid/view/View$OnClickListener;->onClick(Landroid/view/View;)V

    goto :goto_0
.end method

.method public putIntoContainer(Landroid/view/View;)V
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;)V"
        }
    .end annotation

    .prologue
    .line 140
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    .local p1, view:Landroid/view/View;,"TT;"
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mContainedView:Landroid/view/View;

    .line 141
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    invoke-virtual {p0, v1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->removeView(Landroid/view/View;)V

    .line 142
    invoke-static {}, Lcom/burstly/lib/util/Utils;->getFillparentValue()I

    move-result v0

    .line 143
    .local v0, fillparentValue:I
    new-instance v1, Landroid/widget/FrameLayout$LayoutParams;

    const/16 v2, 0x11

    invoke-direct {v1, v0, v0, v2}, Landroid/widget/FrameLayout$LayoutParams;-><init>(III)V

    invoke-virtual {p0, p1, v1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 144
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    invoke-virtual {p0, v1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->addView(Landroid/view/View;)V

    .line 145
    return-void
.end method

.method public run()V
    .locals 2

    .prologue
    .line 290
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 291
    return-void
.end method

.method public setCloseAreaGravity(Ljava/lang/String;)V
    .locals 2
    .parameter "gravity"

    .prologue
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    const/16 v1, 0x32

    .line 154
    new-instance v0, Landroid/widget/FrameLayout$LayoutParams;

    invoke-direct {v0, v1, v1}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    .line 155
    .local v0, closeAreaParams:Landroid/widget/FrameLayout$LayoutParams;
    const-string v1, "top-left"

    invoke-virtual {v1, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 156
    const/16 v1, 0x33

    iput v1, v0, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    .line 170
    :goto_0
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    invoke-virtual {v1, v0}, Landroid/widget/ImageView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 171
    return-void

    .line 157
    :cond_0
    const-string v1, "bottom-left"

    invoke-virtual {v1, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 158
    const/16 v1, 0x53

    iput v1, v0, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    goto :goto_0

    .line 159
    :cond_1
    const-string v1, "bottom-right"

    invoke-virtual {v1, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_2

    .line 160
    const/16 v1, 0x55

    iput v1, v0, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    goto :goto_0

    .line 161
    :cond_2
    const-string v1, "center"

    invoke-virtual {v1, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_3

    .line 162
    const/16 v1, 0x11

    iput v1, v0, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    goto :goto_0

    .line 163
    :cond_3
    const-string v1, "bottom-center"

    invoke-virtual {v1, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_4

    .line 164
    const/16 v1, 0x51

    iput v1, v0, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    goto :goto_0

    .line 165
    :cond_4
    const-string v1, "top-center"

    invoke-virtual {v1, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_5

    .line 166
    const/16 v1, 0x31

    iput v1, v0, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    goto :goto_0

    .line 168
    :cond_5
    const/16 v1, 0x35

    iput v1, v0, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    goto :goto_0
.end method

.method public setCloseClickListener(Landroid/view/View$OnClickListener;)V
    .locals 0
    .parameter "onCloseClickListener"

    .prologue
    .line 264
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseClickListener:Landroid/view/View$OnClickListener;

    .line 265
    return-void
.end method

.method public setShowCloseButtonDelay(J)V
    .locals 2
    .parameter "showCloseButtonDelay"

    .prologue
    .line 282
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    const-wide/16 v0, 0x0

    cmp-long v0, p1, v0

    if-lez v0, :cond_0

    .line 283
    iput-wide p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mShowCloseButtonDelay:J

    .line 284
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    const/16 v1, 0x8

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 286
    :cond_0
    return-void
.end method

.method public setShowCloseIndicator(Z)V
    .locals 1
    .parameter "show"

    .prologue
    .line 192
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    const-string v0, "top-right"

    invoke-virtual {p0, p1, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->setShowCloseIndicator(ZLjava/lang/String;)V

    .line 193
    return-void
.end method

.method public setShowCloseIndicator(ZLjava/lang/String;)V
    .locals 2
    .parameter "show"
    .parameter "gravity"

    .prologue
    .line 204
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    if-eqz p1, :cond_0

    .line 205
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setAdjustViewBounds(Z)V

    .line 206
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/burstly/lib/util/Utils;->getCloseImage(Landroid/content/Context;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->setCloseAreaBackground(Landroid/graphics/drawable/Drawable;)V

    .line 207
    invoke-virtual {p0, p2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->setCloseAreaGravity(Ljava/lang/String;)V

    .line 212
    :goto_0
    return-void

    .line 209
    :cond_0
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->mCloseArea:Landroid/widget/ImageView;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setAdjustViewBounds(Z)V

    .line 210
    const/4 v0, 0x0

    invoke-direct {p0, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->setCloseAreaBackground(Landroid/graphics/drawable/Drawable;)V

    goto :goto_0
.end method

.method public showClose(Z)V
    .locals 0
    .parameter "showClose"

    .prologue
    .line 295
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer<TT;>;"
    invoke-virtual {p0, p1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/CloseableContainer;->setShowCloseIndicator(Z)V

    .line 296
    return-void
.end method
